libxc: xc_ptrace cleanups
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 6 Mar 2006 11:05:44 +0000 (12:05 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 6 Mar 2006 11:05:44 +0000 (12:05 +0100)
commitd531f7eb392bc72a02d54c78fbd240542e423e44
tree20d688e8a0d83fb521377a8e77f27b5cfd6f0dd5
parente827985a3c62b7be91c954f0b30b6175eb5bbcaa
libxc: xc_ptrace cleanups

General Cleanups
* Use { after if consistently in xc_ptrace.c and xc_ptrace_core.c
  (But not in xc_ptrace_core() which should be removed shortly)
* Remove duplicate code and centralise around xc_ptrace.h
* Avoid ifing values covered by case in xc_ptrace()
  - PTRACE_GETREGS, PTRACE_GETFPREGS and PTRACE_GETFPXREGS are grouped into
    a single case, and then with the exception of a call to FETCH_REGS(),
    different code is executed based on ifing the values covered by the
    case.  The PTRACE_GETFPREGS and PTRACE_GETFPXREGS code is actually a
    duplicate.  This patch breaks the code out to two different cases.

Error Handling
* Eliminate FETCH_REGS macro as it forces several functions
  to have an otherwise uneeded error_out label, mittigating
  any code savins.
* Rework error handling in xc_ptrace().
  - Remove FETCH_REGS as above
  - Make sure that all dom0 errors are caught
  - Make sure errno is always set on error
* Eliminate gotos in xc_ptrace_core.c that do nothing but return

Signed-Off-By: Horms <horms@verge.net.au>
tools/libxc/xc_ptrace.c
tools/libxc/xc_ptrace.h
tools/libxc/xc_ptrace_core.c